from typing import Optional

from pydantic import BaseModel, Field


class Attachment(BaseModel):
    id: int = Field(..., description="附件id")
    ownerType: str = Field(..., description="附件所属类型")
    ownerId: int = Field(..., description="附件所属id")
    objName: str = Field(..., description="附件名称")
    filename: str = Field(..., description="附件文件名")
    path: str = Field(..., description="附件路径")
    url: str = Field(..., description="附件url")
    type: str = Field(..., description="附件类型")
    size: int = Field(..., description="附件大小")


class VectorStoreRequest(BaseModel):
    id: int = Field(..., description="书籍id")
    title: str = Field(..., description="书籍标题")
    author: Optional[str] = Field(None, description="书籍作者")
    coverUrl: Optional[str] = Field(None, description="书籍封面")
    description: Optional[str] = Field(None, description="书籍描述")
    publisher: Optional[str] = Field(None, description="书籍出版社")
    publishYear: Optional[int] = Field(None, description="书籍出版年份")
    downloadCount: Optional[int] = Field(None, description="书籍下载次数")
    readCount: Optional[int] = Field(None, description="书籍阅读次数")
    category: Optional[str] = Field(None, description="书籍分类")
    tags: Optional[str] = Field(None, description="书籍标签")
    summary: Optional[str] = Field(None, description="书籍简介")
    bookFile: Attachment

class VectorStoreMetadata(BaseModel):
    id: int = Field(..., description="书籍id")
    title: str = Field(..., description="书籍标题")
    author: Optional[str] = Field(None, description="书籍作者")
    description: Optional[str] = Field(None, description="书籍描述")
    publisher: Optional[str] = Field(None, description="书籍出版社")
    publishYear: Optional[int] = Field(None, description="书籍出版年份")
    category: Optional[str] = Field(None, description="书籍分类")
    tags: Optional[str] = Field(None, description="书籍标签")
    summary: Optional[str] = Field(None, description="书籍简介")